package com.codergd.gra.dao;

import com.codergd.gra.bean.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao {
    @Select("select * from users where iphone = #{iphone}")
    public List<User> selectUser(String iphone);

    @Insert("insert into users(name,iphone,passWord)"
            + "values (#{name},#{iphone},#{passWord})")
    public int insertUser(User user);

    //根据手机号查找id
    @Select("select id from users where iphone = #{iphone}")
    public int selectId(String iphone);

    //修改简历
    @Update("update users set resume = #{resume} where id = #{id}")
    public int changeResume(int id,String resume);

    //修改头像
    @Update("update users set image = #{image} where id = #{id}")
    public int changeHead(int id,String image);

    //修改账号信息
    @Update("update users set name = #{name}, iphone = #{iphone}, passWord = #{paw} where id = #{id}")
    public int changeInfo(int id,String name,String iphone,String paw);

    //修改意向
    @Update("update users set city = #{city},work = #{work},sal = #{sal}," +
            "work1 = #{work1},sal1 = #{sal1},content = #{content} where id = #{id}")
    public int changeWant(int id,String work,String city,int sal, String content,String work1,int sal1);

    //根据用户id查看信息
    @Select("select * from users where id = #{id}")
    @Results({ @Result(property = "passWord", column = "paw")})
    public User selectUserInfo(int id);
}
